import {
    HashRouter as Router,
    Route,
    Switch,
    Link,
    Redirect,
    hashHistory
} from "react-router-dom";
import React, { Suspense, lazy } from "react";
// import Loading from "../assets/RJMart/loading";
// const LoadingComp = <Loading loading={true} delay={0} tip="Loading..." />;

// const PMSideBar = lazy(() => import("./PMSideBar"));
// const Header = lazy(() => import("./Header"));
// const Footer = lazy(() => import("./Footer"));

import PMHeader from "./PMHeader";
import PMFooter from "./PMFooter";
import PMContent from "./PMContent";
// import loadingImg from "@root/imgs/loading.gif";

//ligw begin

// ligw end

//amy bigin
// const Login = lazy(() => import("../pages/Login"));
const Demo = lazy(() => import("../pages/Demo"));
//amy end

const NotFound = lazy(() => import("../pages/NotFound"));
const IndexPage = lazy(() => import("../pages/IndexPage"));

const RouterConfig = () => (
    <Router history={hashHistory}>
        <PMHeader />
        <PMContent>
            <Suspense fallback={<div className="global-loading">加载中</div>}>
                <Switch>
                    <Route path="/" exact component={IndexPage} />
                    <Route path="/bar" component={PMHeader} />
                    <Route path="/indexPage" component={IndexPage} />
                    <Route path="/demo" component={Demo} />
                    {/* ligw end */}

                    {/* amy begin */}
                    {/* amy end */}
                    <Route path="/404" component={NotFound} />
                    <Redirect from="*" to="/404" />
                </Switch>
            </Suspense>
        </PMContent>
        <PMFooter />
    </Router>
);

export default RouterConfig;
